package com.ysl.study.designpattern.createmode.singleton;

/**
 * 单例模式 懒汉模式 同步锁
 *
 * @author yangshanlin
 * @date 2023/2/16 18:12
 * @describe
 */
public class Singleton3 {
    private Singleton3(){}

    private static Singleton3 single = null;

    public static Singleton3 getInstance(){
        if(single == null){
            synchronized (Singleton3.class){
                single = new Singleton3();
            }
        }
        return single;
    }

}
